sum the digits in c#

64

sum the digits in c# -

sum = 0;
while (n != 0) {
    sum += n % 10;
    n /= 10;
}

Comments

Submit
0 Comments